#include "DialogFilterOrder.h"
#include "MainFrame.h"

DialogFilterOrder::DialogFilterOrder( wxWindow* parent )
:
DialogFilterOrderTemplate( parent )
{
	MainFrame* parent1 = (MainFrame*)this->GetParent();

	int filter1 = parent1->getPreFilter1();
	int filter2 = parent1->getPreFilter2();
	int filter3 = parent1->getPreFilter3();
	int filter4 = parent1->getPosFilter1();
	int filter5 = parent1->getPosFilter2();	
	
	comboBoxFilter1->SetSelection(filter1);
	comboBoxFilter2->SetSelection(filter2);
	comboBoxFilter3->SetSelection(filter3);
	comboBoxFilter4->SetSelection(filter4);
	comboBoxFilter5->SetSelection(filter5);
	
	this->ShowModal();
}

void DialogFilterOrder::OnButtonCancelClick( wxCommandEvent& event )
{
	this->EndModal(1);
}

void DialogFilterOrder::OnButtonOkClick( wxCommandEvent& event )
{
	MainFrame* parent = (MainFrame*)this->GetParent();
	
	int filter1 = comboBoxFilter1->GetSelection();
	int filter2 = comboBoxFilter2->GetSelection();
	int filter3 = comboBoxFilter3->GetSelection();
	int filter4 = comboBoxFilter4->GetSelection();
	int filter5 = comboBoxFilter5->GetSelection();
	
	parent->setPreFilter1(filter1);
	parent->setPreFilter2(filter2);
	parent->setPreFilter3(filter3);
	parent->setPosFilter1(filter4);
	parent->setPosFilter2(filter5);
	
	
	this->EndModal(1);
	
}
